package com.jeesite.modules.rt.entity;

import javax.validation.constraints.Size;
import java.util.Date;

import com.jeesite.common.lang.DateUtils;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 收益Entity
 * @author 李寒冰
 * @version 2024-10-16
 */
@Table(name="rt_device_shouyi", alias="a", label="收益信息", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="sn", attrName="sn", label="sn"),
		@Column(name="settle_status", attrName="settleStatus", label="结算状态"),
		@Column(name="amount", attrName="amount", label="收益", isUpdateForce=true),
		@Column(name="price", attrName="price", label="月结设备单价", comment="月结设备单价（元/G）", isUpdateForce=true),
		@Column(name="bandwidth", attrName="bandwidth", label="结算跑量", comment="结算跑量（单位：MB）", isUpdateForce=true),
		@Column(name="total_bandwidth", attrName="totalBandwidth", label="总跑量", comment="总跑量（单位：MB）", isUpdateForce=true),
		@Column(name="resend_bandwidth", attrName="resendBandwidth", label="重传带宽", comment="重传带宽（单位：MB）", isUpdateForce=true),
		@Column(name="isp_code", attrName="ispCode", label="运营商"),
		@Column(name="online_code", attrName="onlineCode", label="在线状态", isUpdateForce=true),
		@Column(name="province_city", attrName="provinceCity", label="省份城市"),
		@Column(name="heartbeat_num", attrName="heartbeatNum", label="总打点数", isUpdateForce=true),
		@Column(name="is_a6", attrName="isA6", label="是否是A6业务"),
		@Column(name="is_province", attrName="isProvince", label="是否是省内调度"),
		@Column(name="is_p6", attrName="isP6", label="是否是P6业务"),
		@Column(name="night_heartbeat_num", attrName="nightHeartbeatNum", label="晚高峰打点数"),
		@Column(name="work_date", attrName="workDate", label="日期", isUpdateForce=true),
		@Column(name="update_time", attrName="updateTime", label="更新时间", isUpdateForce=true),
	}, orderBy="a.id DESC"
)
public class RtDeviceShouyi extends DataEntity<RtDeviceShouyi> {
	
	private static final long serialVersionUID = 1L;
	private String sn;		// sn
	private String settleStatus;		// 结算状态
	private Double amount;		// 收益
	private Double price;		// 月结设备单价（元/G）
	private Double bandwidth;		// 结算跑量（单位：MB）
	private Double totalBandwidth;		// 总跑量（单位：MB）
	private Double resendBandwidth;		// 重传带宽（单位：MB）
	private String ispCode;		// 运营商
	private Long onlineCode;		// 在线状态
	private String provinceCity;		// 省份城市
	private Integer heartbeatNum;		// 总打点数
	private String isA6;		// 是否是A6业务
	private String isProvince;		// 是否是省内调度
	private String isP6;		// 是否是P6业务
	private Date workDate;		// 日期
	private Date updateTime;		// 更新时间
	private Integer nightHeartbeatNum;
	private Double jineDayu;
	private Double jineXiaoyu;
	private String       online;
	private String errorStr;
	private RtDevice rtDevice;
	private Date workDate_gte_date;
	private Date workDate_lte_date;

	public Date getWorkDate_gte_date() {
		return workDate_gte_date;
	}

	public void setWorkDate_gte_date(Date workDate_gte_date) {
		this.workDate_gte_date = workDate_gte_date;
	}

	public Date getWorkDate_lte_date() {
		return workDate_lte_date;
	}

	public void setWorkDate_lte_date(Date workDate_lte_date) {
		this.workDate_lte_date = workDate_lte_date;
	}

	public RtDevice getRtDevice() {
		return rtDevice;
	}

	public void setRtDevice(RtDevice rtDevice) {
		this.rtDevice = rtDevice;
	}


	public String getErrorStr() {
		return errorStr;
	}

	public void setErrorStr(String errorStr) {
		this.errorStr = errorStr;
	}

	public String getOnline() {
		return online;
	}

	public void setOnline(String online) {
		this.online = online;
	}

	private String channelType;

	public String getChannelType() {
		return channelType;
	}

	public void setChannelType(String channelType) {
		this.channelType = channelType;
	}

	public Double getJineDayu() {
		return jineDayu;
	}

	public void setJineDayu(Double jineDayu) {
		this.jineDayu = jineDayu;
	}

	public Double getJineXiaoyu() {
		return jineXiaoyu;
	}

	public void setJineXiaoyu(Double jineXiaoyu) {
		this.jineXiaoyu = jineXiaoyu;
	}

	public Integer getNightHeartbeatNum() {
		return nightHeartbeatNum;
	}

	public void setNightHeartbeatNum(Integer nightHeartbeatNum) {
		this.nightHeartbeatNum = nightHeartbeatNum;
	}

	public RtDeviceShouyi() {
		this(null);
	}
	
	public RtDeviceShouyi(String id){
		super(id);
	}
	
	@Size(min=0, max=255, message="sn长度不能超过 255 个字符")
	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}
	
	@Size(min=0, max=255, message="结算状态长度不能超过 255 个字符")
	public String getSettleStatus() {
		return settleStatus;
	}

	public void setSettleStatus(String settleStatus) {
		this.settleStatus = settleStatus;
	}
	
	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}
	
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}
	
	public Double getBandwidth() {
		return bandwidth;
	}

	public void setBandwidth(Double bandwidth) {
		this.bandwidth = bandwidth;
	}
	
	public Double getTotalBandwidth() {
		return totalBandwidth;
	}

	public void setTotalBandwidth(Double totalBandwidth) {
		this.totalBandwidth = totalBandwidth;
	}
	
	public Double getResendBandwidth() {
		return resendBandwidth;
	}

	public void setResendBandwidth(Double resendBandwidth) {
		this.resendBandwidth = resendBandwidth;
	}
	
	@Size(min=0, max=255, message="运营商长度不能超过 255 个字符")
	public String getIspCode() {
		return ispCode;
	}

	public void setIspCode(String ispCode) {
		this.ispCode = ispCode;
	}
	
	public Long getOnlineCode() {
		return onlineCode;
	}

	public void setOnlineCode(Long onlineCode) {
		this.onlineCode = onlineCode;
	}
	
	@Size(min=0, max=255, message="省份城市长度不能超过 255 个字符")
	public String getProvinceCity() {
		return provinceCity;
	}

	public void setProvinceCity(String provinceCity) {
		this.provinceCity = provinceCity;
	}
	
	public Integer getHeartbeatNum() {
		return heartbeatNum;
	}

	public void setHeartbeatNum(Integer heartbeatNum) {
		this.heartbeatNum = heartbeatNum;
	}
	
	@Size(min=0, max=255, message="是否是A6业务长度不能超过 255 个字符")
	public String getIsA6() {
		return isA6;
	}

	public void setIsA6(String isA6) {
		this.isA6 = isA6;
	}
	
	@Size(min=0, max=255, message="是否是省内调度长度不能超过 255 个字符")
	public String getIsProvince() {
		return isProvince;
	}

	public void setIsProvince(String isProvince) {
		this.isProvince = isProvince;
	}
	
	@Size(min=0, max=255, message="是否是P6业务长度不能超过 255 个字符")
	public String getIsP6() {
		return isP6;
	}

	public void setIsP6(String isP6) {
		this.isP6 = isP6;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	public Date getWorkDate() {
		return workDate;
	}

	public void setWorkDate(Date workDate) {
		this.workDate = workDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public void setWorkDateEq(String workDate){
		Date startDate = DateUtils.parseDate(workDate);
		Date endDate = DateUtils.parseDate(workDate+" 23:59:59");
		this.sqlMap.getWhere().and("work_date", QueryType.GTE, startDate)
				.and("work_date", QueryType.LTE, endDate);
	}

	public void setWorkDate_gte(String workDate){
		this.sqlMap.getWhere().and("work_date", QueryType.GTE, workDate);
	}

	public void setWorkDate_lte(String workDate){
		Date endDate = DateUtils.parseDate(workDate+" 23:59:59");
		this.sqlMap.getWhere().and("work_date", QueryType.LTE, endDate);
	}



}